<template>
  <div class="page-navigation">
    <div class="nav-left">
      <el-button type="primary" plain @click="goBack" size="small">
        <el-icon><Back /></el-icon> 返回
      </el-button>
      
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item v-if="showAdminHome" :to="{ path: '/admin' }">管理中心</el-breadcrumb-item>
        <el-breadcrumb-item v-if="pageTitle">{{ pageTitle }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    
    <div class="nav-right">
      <el-button type="success" plain size="small" @click="goToUserCenter">
        <el-icon><User /></el-icon> 个人中心
      </el-button>
      <el-button type="info" plain size="small" @click="goToHome">
        <el-icon><HomeFilled /></el-icon> 首页
      </el-button>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { Back, User, HomeFilled } from '@element-plus/icons-vue'

const props = defineProps({
  pageTitle: {
    type: String,
    default: ''
  },
  showAdminHome: {
    type: Boolean,
    default: true
  }
})

const router = useRouter()

// 返回上一页
const goBack = () => {
  router.back()
}

// 跳转到个人中心
const goToUserCenter = () => {
  router.push('/user/profile')
}

// 跳转到首页
const goToHome = () => {
  router.push('/')
}
</script>

<style scoped>
.page-navigation {
  margin-bottom: 20px;
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-right {
  display: flex;
  gap: 10px;
}
</style> 